package lab03.test08;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class Test {
    public static void main(String[] args) {
        String sourse = "D://Hello.txt";
        String input="D://world.txt";
        String target = "E://Hello.txt";

        FileInputStream fileInputStream=null;
        FileInputStream fileInputStream11=null;
        FileOutputStream fileOutputStream=null;
        try {
            fileInputStream = new FileInputStream(sourse);
            fileInputStream11=new FileInputStream(input);
            fileOutputStream=new FileOutputStream(target);
            int date;
            int put;
            while ((date=fileInputStream.read())!=-1&&(put=fileInputStream11.read())!=-1){
                fileOutputStream.write(date);
                fileOutputStream.write(put);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            try {
                fileInputStream.close();
                fileInputStream11.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                fileOutputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }

    }

}
